package dt.inlee.system.service;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import dt.inlee.common.pagination.OrderBean;
import dt.inlee.common.pagination.PageBean;
import dt.inlee.common.pagination.SearchBean;
import dt.inlee.system.dao.api.IKqSysroleDeptDao;
import dt.inlee.system.model.KqSysroleDept;


/**
 * @功能说明：角色部门权限信息业务层
 * @作者：陆晓杰
 * @时间：2012.9.13 @
 */
@Service("kqSysroleDeptService")
public class KqSysroleDeptService{
	@Resource(name="kqSysroleDeptDao")
	private IKqSysroleDeptDao kqSysroleDeptDao;
 
	public IKqSysroleDeptDao getKqSysroleDeptDao() {
		return kqSysroleDeptDao;
	}

	public void setKqSysroleDeptDao(IKqSysroleDeptDao kqSysroleDeptDao) {
		this.kqSysroleDeptDao = kqSysroleDeptDao;
	}

	/**
	 * Add a data
	 * @param 
	 * @return
	 */
	public int save(KqSysroleDept entity) {
		return kqSysroleDeptDao.save(entity);
	}
	
	/**
	 * Update a data
	 * @param 
	 * @return
	 */
	public void update(KqSysroleDept entity) {
		kqSysroleDeptDao.update(entity);
	}

	/**
	 * Show a data
	 * @param id
	 * @return
	 */
	public KqSysroleDept getKqSysroleById(Integer id) {		 
		return kqSysroleDeptDao.get(id);
	}
	
	
	/**
	 * Delete an object by id
	 * @param HolidayEntity
	 * @return
	 */
	public void deleteById(int id) {
		kqSysroleDeptDao.delete(id);
    }
	
	public PageBean GetPage(SearchBean sb, int pageIndex, int pageSize) {

		PageBean pageBean=new PageBean();
		pageBean.setPageIndex(pageIndex);
		pageBean.setPageSize(pageSize);
		
		if(sb==null){
			sb=new SearchBean();
		}
		
		OrderBean orderBean=new OrderBean("id",false);
		sb.addOrder(orderBean);
		
		pageBean.setParams(sb);
		this.kqSysroleDeptDao.searchByPagination(pageBean);
		return pageBean;
	}
	
	public List<KqSysroleDept> getList(SearchBean sb)
	{
		return this.kqSysroleDeptDao.find(sb);
	}
	public PageBean getList(SearchBean sb,int rows,int page)
	{
		return this.GetPage(sb, page, rows);
	}
	public List<KqSysroleDept> getList()
	{
		SearchBean sb=new SearchBean();
		return this.kqSysroleDeptDao.find(sb);
	}
}

